package Map;

import java.util.Set;

/**
 * @author lijunhao
 * 2023/7/17
 * @description TODO
 */
public class TreeMap {
    public static void main(String[] args) {
        java.util.TreeMap<Integer , String> map = new java.util.TreeMap<>();
        map.put(10 , "abc");
        map.put(30 , "abd");
        map.put(14 , "abb");
        map.put(22 , "abc");
        // map.put(null , "abc");  不允许存放null键
        map.put(11, null);
        map.put(10 , "aba");
        Set<Integer> keys = map.keySet();
        for (Integer key : keys) {
            String value = map.get(key);
            System.out.println("key = "+key+" , value = "+value);
        }
    }
}
